package org.stars.daostars.operators;

import org.stars.daostars.ConstraintOperator;
import org.stars.daostars.starterkit.EntityBeanBase;

/**
 * Operatore <code>ValidId</code>.
 * Parametri utilizzati:
 * <ul>
 * 		<li>property: SI</li>
 * 		<li>propertyValue: NO</li>
 * 		<li>value: NO</li>
 * </ul>
 * @author Francesco Benincasa (908099)
 *
 */
public class ValidId implements ConstraintOperator {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1709479596617272637L;

	/* (non-Javadoc)
	 * @see it.insiel.daostars.ConstraintOperator#execute(java.lang.Object, java.lang.Object, java.lang.String)
	 */
	@Override
	public boolean execute(Object property, Object propertyValue, String value) {
		boolean ret;
		
		if (property instanceof Long)
		{
			ret=EntityBeanBase.isIdValido((Long)property);
		}
		else
		{
			ret= property==null ? false: true;
		}
		
		return ret;
	}

}
